import 'package:wch/generated/json/base/json_convert_content.dart';
import 'package:wch/model/patient_template.dart';

PatientTemplateModel $PatientTemplateModelFromJson(Map<String, dynamic> json) {
  final PatientTemplateModel patientTemplateModel = PatientTemplateModel();
  final String? code = jsonConvert.convert<String>(json['code']);
  if (code != null) {
    patientTemplateModel.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    patientTemplateModel.msg = msg;
  }
  final PatientTemplateData? data = jsonConvert.convert<PatientTemplateData>(
      json['data']);
  if (data != null) {
    patientTemplateModel.data = data;
  }
  return patientTemplateModel;
}

Map<String, dynamic> $PatientTemplateModelToJson(PatientTemplateModel entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data?.toJson();
  return data;
}

extension PatientTemplateModelExtension on PatientTemplateModel {
  PatientTemplateModel copyWith({
    String? code,
    String? msg,
    PatientTemplateData? data,
  }) {
    return PatientTemplateModel()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

PatientTemplateData $PatientTemplateDataFromJson(Map<String, dynamic> json) {
  final PatientTemplateData patientTemplateData = PatientTemplateData();
  final int? pageIndex = jsonConvert.convert<int>(json['pageIndex']);
  if (pageIndex != null) {
    patientTemplateData.pageIndex = pageIndex;
  }
  final int? pageSize = jsonConvert.convert<int>(json['pageSize']);
  if (pageSize != null) {
    patientTemplateData.pageSize = pageSize;
  }
  final int? totalPage = jsonConvert.convert<int>(json['totalPage']);
  if (totalPage != null) {
    patientTemplateData.totalPage = totalPage;
  }
  final int? totalCount = jsonConvert.convert<int>(json['totalCount']);
  if (totalCount != null) {
    patientTemplateData.totalCount = totalCount;
  }
  final List<PatientTemplateDataData>? data = (json['data'] as List<dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<PatientTemplateDataData>(
          e) as PatientTemplateDataData)
      .toList();
  if (data != null) {
    patientTemplateData.data = data;
  }
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    patientTemplateData.total = total;
  }
  final int? current = jsonConvert.convert<int>(json['current']);
  if (current != null) {
    patientTemplateData.current = current;
  }
  final dynamic records = json['records'];
  if (records != null) {
    patientTemplateData.records = records;
  }
  final int? size = jsonConvert.convert<int>(json['size']);
  if (size != null) {
    patientTemplateData.size = size;
  }
  final int? pages = jsonConvert.convert<int>(json['pages']);
  if (pages != null) {
    patientTemplateData.pages = pages;
  }
  return patientTemplateData;
}

Map<String, dynamic> $PatientTemplateDataToJson(PatientTemplateData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['pageIndex'] = entity.pageIndex;
  data['pageSize'] = entity.pageSize;
  data['totalPage'] = entity.totalPage;
  data['totalCount'] = entity.totalCount;
  data['data'] = entity.data?.map((v) => v.toJson()).toList();
  data['total'] = entity.total;
  data['current'] = entity.current;
  data['records'] = entity.records;
  data['size'] = entity.size;
  data['pages'] = entity.pages;
  return data;
}

extension PatientTemplateDataExtension on PatientTemplateData {
  PatientTemplateData copyWith({
    int? pageIndex,
    int? pageSize,
    int? totalPage,
    int? totalCount,
    List<PatientTemplateDataData>? data,
    int? total,
    int? current,
    dynamic records,
    int? size,
    int? pages,
  }) {
    return PatientTemplateData()
      ..pageIndex = pageIndex ?? this.pageIndex
      ..pageSize = pageSize ?? this.pageSize
      ..totalPage = totalPage ?? this.totalPage
      ..totalCount = totalCount ?? this.totalCount
      ..data = data ?? this.data
      ..total = total ?? this.total
      ..current = current ?? this.current
      ..records = records ?? this.records
      ..size = size ?? this.size
      ..pages = pages ?? this.pages;
  }
}

PatientTemplateDataData $PatientTemplateDataDataFromJson(
    Map<String, dynamic> json) {
  final PatientTemplateDataData patientTemplateDataData = PatientTemplateDataData();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    patientTemplateDataData.id = id;
  }
  final int? hospitalId = jsonConvert.convert<int>(json['hospitalId']);
  if (hospitalId != null) {
    patientTemplateDataData.hospitalId = hospitalId;
  }
  final int? doctorId = jsonConvert.convert<int>(json['doctorId']);
  if (doctorId != null) {
    patientTemplateDataData.doctorId = doctorId;
  }
  final int? num = jsonConvert.convert<int>(json['num']);
  if (num != null) {
    patientTemplateDataData.num = num;
  }
  final String? templateName = jsonConvert.convert<String>(
      json['templateName']);
  if (templateName != null) {
    patientTemplateDataData.templateName = templateName;
  }
  final String? adminUser = jsonConvert.convert<String>(json['adminUser']);
  if (adminUser != null) {
    patientTemplateDataData.adminUser = adminUser;
  }
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    patientTemplateDataData.createTime = createTime;
  }
  final String? updateTime = jsonConvert.convert<String>(json['updateTime']);
  if (updateTime != null) {
    patientTemplateDataData.updateTime = updateTime;
  }
  final dynamic list = json['list'];
  if (list != null) {
    patientTemplateDataData.list = list;
  }
  return patientTemplateDataData;
}

Map<String, dynamic> $PatientTemplateDataDataToJson(
    PatientTemplateDataData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['hospitalId'] = entity.hospitalId;
  data['doctorId'] = entity.doctorId;
  data['num'] = entity.num;
  data['templateName'] = entity.templateName;
  data['adminUser'] = entity.adminUser;
  data['createTime'] = entity.createTime;
  data['updateTime'] = entity.updateTime;
  data['list'] = entity.list;
  return data;
}

extension PatientTemplateDataDataExtension on PatientTemplateDataData {
  PatientTemplateDataData copyWith({
    String? id,
    int? hospitalId,
    int? doctorId,
    int? num,
    String? templateName,
    String? adminUser,
    String? createTime,
    String? updateTime,
    dynamic list,
  }) {
    return PatientTemplateDataData()
      ..id = id ?? this.id
      ..hospitalId = hospitalId ?? this.hospitalId
      ..doctorId = doctorId ?? this.doctorId
      ..num = num ?? this.num
      ..templateName = templateName ?? this.templateName
      ..adminUser = adminUser ?? this.adminUser
      ..createTime = createTime ?? this.createTime
      ..updateTime = updateTime ?? this.updateTime
      ..list = list ?? this.list;
  }
}